<?php
/**
 * Created by PhpStorm.
 * User: Liuchenling
 * Date: 5/27/15
 * Time: 21:15
 */

include_once('RSA.class.php');
/**
 * 以下为测试
 */
$rsa = new RSA("./rsa_public_key.pem", "./rsa_private_key.pem");
function p($data = ''){echo $data . "\n";}

//公钥加密, 私钥解密测试
p("公钥加密的编码: ");
p($abc = $rsa->pubKeyEncrypt("abc"));p(); //公钥加密abc

p("解密输出: ");
p($rsa->priKeyDecrypt($abc));p(); //私钥解密abc
p();

//私钥加密, 公钥解密测试
p('私钥加密的编码: ');
p($def = $rsa->priKeyEncrypt("def"));p(); //私钥加密def
p("解密输出: ");
p($rsa->pubKeyDecrypt($def)); //公钥解密def